package com.yeyaomai.dksns.flowis.domain;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;

/**
 * 访问地区分布
 * 
 * @author xiaqin
 * @date 2012-08-15
 */
public class VisitArea extends Entity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;

	private Date referDate;

	private String province;

	private String city;

	private Integer visitCount;

	private Integer uniqueHost;

	private Integer ip;

	private Integer newUniqueHost;

	private Long avgStopTime;

	private String avgCount;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getReferDate() {
		return referDate;
	}

	public void setReferDate(Date referDate) {
		this.referDate = referDate;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Integer getVisitCount() {
		return visitCount;
	}

	public void setVisitCount(Integer visitCount) {
		this.visitCount = visitCount;
	}

	public Integer getUniqueHost() {
		return uniqueHost;
	}

	public void setUniqueHost(Integer uniqueHost) {
		this.uniqueHost = uniqueHost;
	}

	public Integer getIp() {
		return ip;
	}

	public void setIp(Integer ip) {
		this.ip = ip;
	}

	public Integer getNewUniqueHost() {
		return newUniqueHost;
	}

	public void setNewUniqueHost(Integer newUniqueHost) {
		this.newUniqueHost = newUniqueHost;
	}

	public long getAvgStopTime() {

		return avgStopTime;
	}

	public void setAvgStopTime(Long avgStopTime) {
		this.avgStopTime = avgStopTime;
	}

	public String getAvgCount() {
		avgCount = this.getUniqueHost() == 0 ? "0.00" : String.format("%.2f",
				(double) this.getVisitCount() / this.getUniqueHost());
		return avgCount;
	}

	public void setAvgCount(String avgCount) {
		this.avgCount = avgCount;
	}

	public String getProvinceName() throws UnsupportedEncodingException {
		return URLEncoder.encode(province,"UTF-8");
	}

}
